package com.bozai.redis;

import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.redis.core.RedisTemplate;

@SpringBootTest
public class StudentServiceTest {

    @Autowired
    private RedisTemplate<String, Object> redisTemplate;  // 添加泛型

    @Test
    public void testSaveAndGetStudent() {
        redisTemplate.opsForValue().set("user2","bozai2");//写数据
        Object user1 = redisTemplate.opsForValue().get("user2");//读数据
        System.out.println(user1);
    }
}